package com.haois.ws.web.module.system.service;

import com.haois.ws.common.util.GsonUtil;
import com.haois.ws.common.constant.daomain.SmsRep;
import com.haois.ws.web.module.system.dao.mapper.RecordMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;


/**
 * Created by RuiHaoZ on 2018/1/9 21:45
 */
@Service
public class SmsRecordService {
    @Autowired
    private RecordMapper recordMapper;

    private Logger logger = LoggerFactory.getLogger(SmsRecordService.class);

    public void add(SmsRep smsRep) {
        smsRep.setCreateTime(new Date());
        smsRep.setContent(GsonUtil.toJson(smsRep));
        smsRep.setType("1");
        recordMapper.addSms(smsRep);
    }

    public SmsRep getByMobile(String mobile){
        return recordMapper.getByMobile(mobile);
    }
}
